Skip to content

docs(inference): explain neighbor search in Python and ASE - #6156

Open
Miller10101010 wants to merge 3 commits into
deepmodeling:masterfrom
Miller10101010:docs-python-neighbor-search
Open

Miller10101010 wants to merge 3 commits into
deepmodeling:masterfrom
Miller10101010:docs-python-neighbor-search

Conversation

@Miller10101010

@Miller10101010 Miller10101010 commented Nov 24, 2026 •

Copy link
Copy Markdown

Document nlist_backend for the PyTorch Exportable backend, optional search libraries and the separate neighbor_graph_method used by graph-form models. Include examples for DeepPot and the ASE calculator.

Verified auto, native and vesin with frozen .pt2 and .pte water models in Python and ASE. Also checked the missing-library diagnostic and the error for an incompatible graph input.

Closes #5922.

Summary by CodeRabbit

  • Documentation
    • Added guidance on selecting a neighbor-search backend for frozen .pt2 and .pte models, including automatic selection for single-frame and multi-frame batches.
    • Documented supported model types, native-search behavior, and alternatives for edge-vector models.
    • Explained search costs, Vesin installation and import-error behavior, and usage with DeepPot and the ASE calculator.
    • Clarified the distinction between neighbor-list and graph-form models, and renamed the external-neighbor-list heading.

@github-actions github-actions Bot added the Docs label Nov 24, 2026
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Python inference documentation updates its neighbor-search section. It describes nlist_backend choices, selection behavior for frozen .pt2 and .pte models, Vesin requirements, usage examples, and parameter constraints for graph-form and edge-vector models.

Changes: Python inference documentation

Layer / File(s) Summary
Neighbor-list selection guidance
doc/inference/python.md
The section heading changes. New guidance describes backend selection, supported options, Vesin requirements and import-error behavior, usage with DeepPot and the ASE calculator, and model-specific parameter constraints.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Suggested reviewers: njzjz

Merge Risk: Minimal · up to cf79e

This PR only updates the Python inference docs to explain neighbor-search options. It does not change runtime behavior, and no merge-blocking concerns remain.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "docs(inference): explain neighbor search in Python and ASE" matches the main change. The raw summary and objectives show the PR documents nlist_backend choices (auto, native, vesin) for PyT…
Linked Issues check Passed [#5922] The issue requires Python/ASE documentation of nlist_backend for PyTorch Exportable models. The whole-PR diff of doc/inference/python.md (merge base to head) shows:
- The TensorFlow external n…
Out of Scope Changes check Passed All changes are in doc/inference/python.md. The added content covers the nlist_backend argument, the optional vesin dependency and its failure mode, DeepPot and ASE examples, and the separate graph-fo…
Full details: Title check

Explanation

The title "docs(inference): explain neighbor search in Python and ASE" matches the main change. The raw summary and objectives show the PR documents nlist_backend choices (auto, native, vesin) for PyTorch Exportable models, optional Vesin installation and import-error behavior, use with DeepPot and the ASE calculator, and the separate graph-form neighbor construction. The title is short, specific, and uses the conventional type(scope) prefix. The commit message about virtual-atom spin models is a minor addition that the title does not need to cover.

Full details: Linked Issues check

Explanation

[#5922] The issue requires Python/ASE documentation of nlist_backend for PyTorch Exportable models. The whole-PR diff of doc/inference/python.md (merge base to head) shows:

  • The TensorFlow external neighbor list content and its ASE example are kept under "External neighbor list {{ tensorflow_icon }}".
  • A "PyTorch Exportable neighbor lists {{ pytorch_icon }}" subsection covers frozen .pt2 and .pte models for DeepPot and the ASE calculator.
  • The table documents "auto", "native", "vesin" and "nv". The "vesin" row names the optional vesin[torch]>=0.6 install and the ImportError for an explicit request without Torch bindings. The "nv" row is an extra value of the same argument.
  • The examples DeepPot("model.pt2", nlist_backend="vesin") and DP(model=..., nlist_backend="vesin") match the documented usage.
  • The graph-form note states that neighbor_graph_method selects the graph builder and that a non-default nlist_backend raises ValueError for graph-form models. This matches the issue requirement that the option does not control graph-form models.
    The exact ImportError and ValueError text was not checked in this assessment. The issue does not require quoting that text. The incremental diff from the previous reviewed heads could not be read, so this verdict rests on the whole-PR diff and the previously reviewed code evidence. No coding requirement in #5922 needs an automated test. The issue is documentation-only.
Full details: Out of Scope Changes check

Explanation

All changes are in doc/inference/python.md. The added content covers the nlist_backend argument, the optional vesin dependency and its failure mode, DeepPot and ASE examples, and the separate graph-form option. The additional "nv" row, the virtual-atom spin model note and the native-spin edge-vector note describe selection behavior of the same nlist_backend argument. They are related documentation, not unrelated changes. The issue excludes LAMMPS neighbor lists, and the diff does not document them. The incremental diff from the previous reviewed heads could not be read. This verdict rests on the whole-PR diff.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9b45069c-955b-454c-a40c-32135b16bc8d
Commits

Reviewing files that changed from the base of the PR and between a8522ae and cf79e64.

Files selected for processing: 1

  • doc/inference/python.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

@OutisLi OutisLi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DeepPot and ASE examples use the correct argument. Please qualify one backend restriction in the guide.

Comment thread doc/inference/python.md

| `nlist_backend` | Neighbor search |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `"auto"` | Select by availability and frame count. |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please qualify this table for virtual-atom spin artifacts with the nlist lower: _setup_neighbor_backend rejects explicit vesin and nv even when the libraries are installed. auto and native use the native builder there; this is distinct from native-spin edge-vector artifacts. It would also help to give the full auto order where eligible: Vesin → NV → native for one frame, and NV → Vesin → native for a batch.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in cf79e64.

Updated the backend table notes to spell out the single-frame order (Vesin, NV, native), the batched order (NV, Vesin, native), and the virtual-atom spin restriction. I checked the selector on AISI: for the virtual-atom nlist path, auto and native used the native builder, while explicit vesin and nv each raised the expected error.

@codecov

codecov Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.85%. Comparing base (ed85942) to head (a8522ae).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6156      +/-   ##
==========================================
- Coverage   78.09%   77.85%   -0.24%     
==========================================
  Files        1214     1214              
  Lines      147782   147782              
  Branches     5246     5249       +3     
==========================================
- Hits       115410   115063     -347     
- Misses      30392    30740     +348     
+ Partials     1980     1979       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@OutisLi
OutisLi self-requested a review November 26, 2026 01:28

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs(inference): document vesin neighbor list and nlist_backend for Python/ASE inference

2 participants